home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-11-11 | 8.1 KB | 331 lines | [TEXT/MPS ] |
- ;
- ; File: WorldScript.a
- ;
- ; Copyright: © 1984-1994 by Apple Computer, Inc.
- ; All rights reserved.
- ;
- ; Version: Universal Interfaces 2.0a3 ETO #16, MPW prerelease. Friday, November 11, 1994.
- ;
- ; Bugs?: If you find a problem with this file, send the file and version
- ; information (from above) and the problem description to:
- ;
- ; Internet: apple.bugs@applelink.apple.com
- ; AppleLink: APPLE.BUGS
- ;
- ;
-
- IF &TYPE('__WORLDSCRIPT__') = 'UNDEFINED' THEN
- __WORLDSCRIPT__ SET 1
-
-
- IF &TYPE('__TYPES__') = 'UNDEFINED' THEN
- include 'Types.a'
- ENDIF
- ; include 'ConditionalMacros.a' ;
-
- IF &TYPE('__TRAPS__') = 'UNDEFINED' THEN
- include 'Traps.a'
- ENDIF
-
- IF &TYPE('__QUICKDRAWTEXT__') = 'UNDEFINED' THEN
- include 'QuickdrawText.a'
- ENDIF
- ; include 'MixedMode.a' ;
-
- kVariableLengthArray EQU 1
-
- ; offset from start of sub-table to row in state table
- kScriptSettingsTag EQU 'info'
- kMetamorphosisTag EQU 'mort'
- kGlyphExpansionTag EQU 'g2g#'
- kPropertiesTag EQU 'prop'
- kJustificationTag EQU 'kash'
- kCharToGlyphTag EQU 'cmap'
- kGlyphToCharTag EQU 'pamc'
- kFindScriptRunTag EQU 'fstb'
-
- ;*** L O O K U P T A B L E T Y P E S ***
- WSILookupSimpleArray EQU 0 ; a simple array indexed by glyph code
- WSILookupSegmentSingle EQU 2 ; segment mapping to single value
- WSILookupSegmentArray EQU 4 ; segment mapping to lookup array
- WSILookupSingleTable EQU 6 ; sorted list of glyph, value pairs
- WSILookupTrimmedArray EQU 8 ; a simple trimmed array indexed by glyph code
-
- ; An offset from the beginning of the lookup table
- ; FORMAT SPECIFIC DEFINITIONS
- ;
- ; lookupSimpleArray:
- ;
- ; This is a simple array which maps all glyphs in the font
- ; to lookup values.
- ;
- WSILookupArrayHeader RECORD 0
- lookupValues ds.w 1 ; The array of values indexed by glyph code
- sizeof EQU 2
- ENDR
-
- ;
- ; lookupTrimmedArray:
- ;
- ; This is a single trimmed array which maps a single range
- ; of glyhs in the font to lookup values.
- ;
- WSILookupTrimmedArrayHeader RECORD 0
- firstGlyph ds.w 1
- limitGlyph ds.w 1
- valueArray ds.w 1
- sizeof EQU 6
- ENDR
-
- ; The format specific part of the subtable header
- WSILookupFormatSpecificHeader RECORD 0
- VariantLevel0Begin EQU *
- lookupArray ds WSILookupArrayHeader
- ORG VariantLevel0Begin
- trimmedArray ds WSILookupTrimmedArrayHeader
- sizeof EQU 6
- ENDR
-
- ; The overall subtable header
- WSILookupTableHeader RECORD 0
- format ds.w 1 ; table format
- fsHeader ds.w 3 ; format specific header
- sizeof EQU 8
- ENDR
-
- ;*** G L Y P H E X P A N S I O N ***
-
- ; fixed 1.0
- kCurrentGlyphExpansionVersion EQU $00010000
-
- GlyphExpansionLookupFormat EQU 1
- GlyphExpansionContextualFormat EQU 2
-
- ExpandedGlyphCluster RECORD 0
- numGlyphs ds.b 1
- bestGlyph ds.b 1
- glyphs ds.w 1
- sizeof EQU 4
- ENDR
-
- ExpandedGlyphOffset RECORD 0
- glyph ds.w 1
- offset ds.w 1 ; offset to ExpandedGlyphCluster
- sizeof EQU 4
- ENDR
-
- GlyphExpansionStateTable RECORD 0
- stateTableOffset ds.w 1
- classTableOffset ds.w 1
- actionTableOffset ds.w 1 ; state, class and actions tables follow here...
- sizeof EQU 6
- ENDR
-
- GlyphExpansionTable RECORD 0
- version ds.l 1
- format ds.w 1
- expansionNumer ds.w 1
- expansionDenom ds.w 1 ; num/denom ratio for expansion <2>
- VariantLevel0Begin EQU *
- stateTable ds GlyphExpansionStateTable
- ORG VariantLevel0Begin
- lookup ds WSILookupTableHeader ; expanded glyph clusters follow here...
- sizeof EQU 18
- ENDR
-
- ; Glyph-to-Character constants and types
-
- kCurrentGlyphToCharVersion EQU $00010100
-
- kGlyphToCharLookup8Format EQU 1
- kGlyphToCharLookup16Format EQU 2
- kGlyphToCharLookup32Format EQU 3
-
- GlyphToCharActionTable RECORD 0
- fontNameOffset ds.w 1 ; offset relative to this table
- actions ds WSILookupTableHeader ; only support lookupSimpleArray format for now
- sizeof EQU 10
- ENDR
-
- GlyphToCharActionHeader RECORD 0
- numTables ds.w 1 ; 0..n
- offsets ds.w 1 ; offsets from start of action table header
- sizeof EQU 4
- ENDR
-
- GlyphToCharHeader RECORD 0
- version ds.l 1
- actionOffset ds.w 1 ; offset to GlyphToCharActionHeader
- format ds.w 1 ; size of font mask
- mappingTable ds WSILookupTableHeader
- sizeof EQU 16
- ENDR
-
- ; JUSTIFICATION TYPES
- ; WorldScript supports justification of text using insertion. The justification
- ; table specifies a insertion string to insert between 2 specified glyphs.
- ; Each combination of inter-glyph boundary can be assigned a justification priority,
- ; the higher the priority the more justification strings inserted at that position.
- ;
- ; The priorities for each inter-glyph boundary are specified by the justification table's
- ; state table.
- ;
- ; Special handling is done for scripts which use spaces to justify, because the width of
- ; a space varies depending on the setting of SpaceExtra. This is why the number of spaces
- ; per inserting string is specified in the justification table.
- ;
- ;
-
- ; 1.0 not supported
- kCurrentJustificationVersion EQU $0200
-
- kJustificationStateTableFormat EQU 1
-
- ; WSI's internal limitation <12>
- kMaxJustificationStringLength EQU 13
-
- WSIJustificationSetMarkMask EQU $80
-
- WSIJustificationStateEntry RECORD 0
- markPriority ds.b 1 ; non-zero priorities means insertion
- priority ds.b 1
- newState ds.w 1
- sizeof EQU 4
- ENDR
-
-
- wsiJustEndOfLineClass EQU 0
- wsiJustEndOfRunClass EQU 1
- wsiJustDeletedGlyphClass EQU 2
- wsiJustUserDefinedClass EQU 3
-
- wsiStartOfLineState EQU 0 ; pre-defined states
- wsiStartOfRunState EQU 1
- wsiUserDefinedState EQU 2
-
- ; pre-multiplied: class# * sizeof(WSIJustificationStateEntry)
- WSIJustificationStateTable RECORD 0
- maxPriorities ds.w 1
- rowWidth ds.w 1 ; width of a state table row in bytes
- classTableOffset ds.w 1
- stateTableOffset ds.w 1
- sizeof EQU 8
- ENDR
-
- WSIJustificationHeader RECORD 0
- version ds.w 1
- format ds.w 1
- scaling ds Point ; numer/denom scaling of priority weights <7>
- spacesPerInsertion ds.w 1 ; # of $20 chars in justification insertion string <12>
- justStringOffset ds.w 1 ; offset to justification string
- stateTable ds WSIJustificationStateTable ; long-aligned boundary aligned w/ spacesPerInsertion field - justification string follows
- sizeof EQU 20
- ENDR
-
- ; Line Layout's Property table version <11>
-
- ; v1.0
- currentPropsTableVersion EQU $00010000
-
- ; ??? is this right
- kCharToGlyphCurrentVersion EQU 0100
-
- ; pass as priorityWeight to JustifyWSILayout to use script's current just setting
- kScriptsDefaultJustWeight EQU -1
-
- WSIGlyphInfoRec RECORD 0
- qdChar ds.b 1
- rightToLeft ds.b 1 ; !0 means rightToLeft, 0 means leftToRight
- fontID ds.w 1
- originalOffset ds.w 1 ; or negative original offset if not in original text input
- unused ds.w 1 ; long-align
- sizeof EQU 8
- ENDR
-
- IF GENERATING68K THEN
- Macro
- _NewWSILayout
- dc.w $2F3C
- dc.w $8414
- dc.w $0040
- dc.w $A8B5
- EndM
- ELSE
- IMPORT NewWSILayout
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _JustifyWSILayout
- dc.w $2F3C
- dc.w $8418
- dc.w $0042
- dc.w $A8B5
- EndM
- ELSE
- IMPORT JustifyWSILayout
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _MeasureWSILayout
- dc.w $2F3C
- dc.w $840C
- dc.w $0044
- dc.w $A8B5
- EndM
- ELSE
- IMPORT MeasureWSILayout
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _DrawWSILayout
- dc.w $2F3C
- dc.w $800C
- dc.w $0046
- dc.w $A8B5
- EndM
- ELSE
- IMPORT DrawWSILayout
- ENDIF
-
- ; "low-level" routines
- IF GENERATING68K THEN
- Macro
- _GetWSILayoutParts
- dc.w $2F3C
- dc.w $8410
- dc.w $0048
- dc.w $A8B5
- EndM
- ELSE
- IMPORT GetWSILayoutParts
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _DrawWSIGlyphs
- dc.w $2F3C
- dc.w $800E
- dc.w $004A
- dc.w $A8B5
- EndM
- ELSE
- IMPORT DrawWSIGlyphs
- ENDIF
-
- IF GENERATING68K THEN
- Macro
- _xMeasureWSIGlyphs
- dc.w $2F3C
- dc.w $840E
- dc.w $004C
- dc.w $A8B5
- EndM
- ELSE
- IMPORT xMeasureWSIGlyphs
- ENDIF
-
- ENDIF ; __WORLDSCRIPT__
-